<?php
$CI =& get_instance();
$CI->load->library('pagination');
$CI->load->model('Model_data', 'model_data');
$CI->load->model('Model_datagroup', 'model_datagroup');

$t1 = $content['t1'];
$t1 = unserialize($t1);

$total = $CI->model_data->find_by_group_count($t1['group']);
$offset = 0;
$per_page = $this->uri->segment(4,0);
if($per_page < $total){
	$offset = $per_page;
}
$limit = $t1['quantity'];

$list = $CI->model_data->find_by_group($t1['group'], $limit, $offset);

$config['base_url'] = site_url(array('c'=>'home', 'm'=>'index', 'nav'=>$node['id']));
$config['uri_segment'] = 4;
$config['total_rows'] = $total;
$config['per_page'] = $limit;
$CI->pagination->initialize($config);
?>
<div class="left-2-col texture">
</div>
<div class="col_center" id="page_search">
	<h2><?= $content['name'];?></h2>
	<div class="data-cont">
		<ul class="data-list">
		<?php if(!empty($list)):?>
		<?php foreach($list as $item):?>
		<li>	
			<a href="<?=site_url(array("c" => "home", "m"=> "downloaddata", "id"=>$item['id']))?>" title="<?=htmlspecialchars($item['name'])?>"><?=htmlspecialchars($item['name'])?></a>
			<p><?=$item['description']?></p>
		</li>
		<?php endforeach;?>
		<?php endif;?>
		</ul>
		<div class="clearfix"></div>
		<div class="pagination"><?=$CI->pagination->create_links();?></div>
	</div>
</div>
<div class="clearfix"></div>